home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 16893 / Birdie Crush.7z / BirdieCrushDownload.py next >
Encoding:
Python Source  |  2019-10-11  |  1.5 KB  |  56 lines

  1. #https://image-glb.qpyou.cn/g2/Jenkins/AssetBundles/rev52831/Android/bundle_default_character_d01_m010_bundle
  2. import xml.etree.ElementTree as ET
  3. from urllib.request import ProxyHandler, build_opener, install_opener, urlopen
  4. from itertools import islice
  5. from multiprocessing.dummy import Pool as ThreadPool
  6. import os
  7. import io
  8. import struct
  9. pool = ThreadPool(10)
  10.  
  11. if not os.path.exists("BirdieCrush"):
  12.     os.makedirs("BirdieCrush")
  13. #proxy = urllib.request.ProxyHandler({'http': 'http://192.168.1.91:8888'})
  14. proxy = ProxyHandler({})
  15. opener = build_opener(proxy)
  16. opener.addheaders = []
  17. install_opener(opener)
  18.  
  19. def geturl(name, name2):
  20.     try:
  21.         fldr = 'BirdieCrush'
  22.         if os.path.exists(fldr + '/' + name + '.unity3d'):
  23.             pass
  24.         else:
  25.             print('Downlaoding',name)
  26.             print(fldr + '/' + name + '.unity3d')
  27.             dl = URL + '/Android/' + name
  28.             print(dl)
  29.             myFile = urlopen(dl).read()
  30.             with open(fldr + '/' + name + '.unity3d', 'wb') as f:
  31.                 f.write(myFile)
  32.         
  33.     except:
  34.         pass
  35.  
  36.  
  37.  
  38. tree = ET.parse('ResourcePatchInfo.xml')
  39. root = tree.getroot()
  40. print(root)
  41. VER = ''
  42. URL = ''
  43. FNAME = []
  44. for child in root:
  45.     print(child.tag, child.attrib)
  46.     for item in child:
  47.         if child.tag == 'Info':
  48.             #print(item.attrib['Ver'])
  49.             VER = item.attrib['Ver']
  50.         if child.tag == 'PatchInfo':
  51.             #print(item.attrib['URL'])
  52.             URL = item.attrib['URL']
  53.         if child.tag == 'Asset':
  54.             #print(item.attrib['FileName'])
  55.             FNAME.append(item.attrib['FileName'])
  56. pool.starmap(geturl,  zip(FNAME,FNAME))